﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlDieuChinhTonKho.ascx.cs" Inherits="UserControl_ControlDieuChinhTonKho" %>
 <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

 <%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxPopupControl" tagprefix="dxpc" %>


<script type="text/javascript">
    function pageLoad() {

       
        //Lấy ngày workingday
        $.ajax({
            type: "POST",
            url: '<%=ResolveUrl("~/Webservice/WebServiceDRM.asmx/GetWorkingDay")%>',
            data: "{}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                $("#<%= txtDate.ClientID %>").datePicker(
		        {
		            clickInput: true,
		            startDate: data.d
		        });
            }
        });

       

        $("#<%= imgBtnAdd.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= btnSave.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= btnDelete.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        
    $("#<%= ImgBtnRequest.ClientID %>").click(function () {
        $.blockUI({ css: {
            border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
        }
        });
    });

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }
    }

</script>


<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
     
     <div class="direct_container_right_titletop">
                     Điều chỉnh tồn kho
                </div>
                 <hr />
                <!-- Button chuc nang-->
                <div class="direct_container_main">
                    <asp:ImageButton ID="imgBtnAdd" ToolTip="Tạo mới mghiệp vụ" onclick="imgBtnAdd_Click" CausesValidation="false" ImageUrl="~/Images/add.png" Width="32px" Height="32px" runat="server" />
                    <%--<asp:ImageButton ID="imgBtnSave" ToolTip="Lưu nghiệp vụ" onclick="imgBtnSave_Click" ImageUrl="~/Images/save.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnDelete" ToolTip="Xóa nghiệp vụ" onclick="imgBtnDelete_Click" ImageUrl="~/Images/delete.png" Width="32px" Height="32px" runat="server" />
                    --%>
                    <div style="display:none">
                        <asp:Button ID="btnDefault" runat="server" Text="Default" onclick="btnDefault_Click"/>
                    </div>    
                </div>
                <!-- End Button chuc nang-->
                <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="0" 
            BackColor="#CCFFFF" Font-Names="Arial" 
            Width="100%">
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Nhập thông tin" TabIndex="0">
                 <ContentTemplate>
                         <!-- Content main-->
                <div class="direct_container_main">
                    <div class="direct_container_form_right">
                        <table border="0" width="100%">
                           <tr>
                                <td colspan="4" align="center">
                                    <asp:Label ID="lblMsg" runat="server" Visible="false" BackColor="Silver" ForeColor="Blue" Font-Bold="true" Font-Italic="true"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td align="right"><p class="direct_label">Số chứng từ</p></td>
                                <td align="left">
                                 <asp:TextBox ID="txtSoChungTu" ReadOnly="True" CssClass="input_code"  runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td align="right"><p class="direct_label">Ngày</p></td>
                                <td align="left">
                                    <asp:TextBox ID="txtDate" CssClass="input_code" runat="server"></asp:TextBox>
                                
                                    <asp:Button ID="btnSave" runat="server" Text="Lưu" onclick="btnSave_Click"/>
                                    
                                    <asp:Button ID="btnDelete" runat="server" Text="Xóa" onclick="btnDelete_Click"/>
                                </td>
                            </tr>

                           
                            <tr>
                                <td colspan="2">
                                
                                    <asp:GridView ID="grvProduct" runat="server" AutoGenerateColumns="False" 
                                onrowcancelingedit="grvProduct_RowCancelingEdit" 
                    onrowediting="grvProduct_RowEditing" onrowupdating="grvProduct_RowUpdating" onpageindexchanging="grvProduct_PageIndexChanging" 
                    onrowdeleting="grvProduct_RowDeleting" DataKeyNames="Mã hàng" EnableModelValidation="True" AllowPaging="True" PageSize="20"><Columns>
<asp:TemplateField HeaderText="Stt">
<HeaderTemplate>
                                                                    STT
                                                                
                                         
</HeaderTemplate>
<ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Mã hàng"><HeaderTemplate>
                                                                    Mã hàng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                  
                  <asp:Label ID="lblMaHang" runat="server" Text='<%# Eval("Mã hàng")%>'></asp:Label>                                               
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Tên hàng"><HeaderTemplate>
                                                                    Tên hàng
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
                    <asp:Label ID="lblTenHang" runat="server" Text='<%# Eval("Tên hàng")%>'></asp:Label>                                             
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="200px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="200px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Tồn đầu">

<HeaderTemplate>
                                                                    Tồn đầu
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
          
             <asp:Label ID="lblSL" runat="server" Text='<%# Eval("Số lượng")%>'></asp:Label>                                                   
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Điều chỉnh">
<EditItemTemplate>
             <asp:TextBox ID="txtSLTThem" CssClass="input_code" Text='<%# Eval("Tăng thêm")%>' runat="server"></asp:TextBox>
             <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender3" 
                                                        runat="server" Enabled="True" FilterType="Custom,Numbers" 
                                                        TargetControlID="txtSLTThem" InvalidChars="-" >
                                                 </cc1:FilteredTextBoxExtender>
</EditItemTemplate>
<HeaderTemplate>
                                                                    Điều chỉnh
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
          
             <asp:Label ID="lblSLTThem" runat="server" Text='<%# Eval("Tăng thêm")%>'></asp:Label>                                                   
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Tồn sau điều chỉnh">

<HeaderTemplate>
                                                                    Sau điều chỉnh
                                                                
</HeaderTemplate>
<ItemTemplate>
                                                                   
          
             <asp:Label ID="lblSLSauDieuChinh" runat="server" Text='<%# Eval("Tồn sau")%>'></asp:Label>                                                   
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="150px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
</asp:TemplateField>
<asp:CommandField CausesValidation="False" HeaderText="Sửa" 
                                                                 ShowEditButton="True" ButtonType="Image"
                                                                EditImageUrl="~/images/repair_bt.png" EditText="Sửa" 
                                                                CancelImageUrl="~/images/exit_bt.png" CancelText="Thoát" UpdateText="Cập nhập" 
                                                                UpdateImageUrl="~/images/update_bt.png" >
<ControlStyle Height="25px" Width="25px" />

<ItemStyle Height="25px" Width="25px" />
</asp:CommandField>
<asp:CommandField  ButtonType="Image" DeleteText="Xóa" 
                                                                DeleteImageUrl="~/images/delete.png" CausesValidation="False" HeaderText="Xóa" 
                                                                 ShowDeleteButton="True" >
<ControlStyle Height="25px" Width="25px" />

<ItemStyle Height="25px" Width="25px" />
</asp:CommandField>
</Columns>
</asp:GridView>
                                
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <!-- EndContent main-->
                 </ContentTemplate>
            </cc1:TabPanel>
             <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Tìm kiếm" TabIndex="1">
                <ContentTemplate>
                     <!-- Content search -->
                <div class="direct_container_main">
                     <div class="direct_container_form_right">
                         <table border="0" width="100%">
                                    <tr>
                                        <td>
                                            <asp:ImageButton ID="ImgBtnRequest" ToolTip="Cập nhật kết quả tìm kiếm" onclick="ImgBtnRequest_Click" CausesValidation="false" ImageUrl="~/Images/Refresh.png" Width="32px" Height="32px" runat="server" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                        
                                       <asp:GridView ID="grvSearch" runat="server" PageSize="10" AutoGenerateColumns="False" 
                                                        DataKeyNames="docno" EnableModelValidation="True" onpageindexchanging="grvSearch_PageIndexChanging" 
                                                        onrowcommand="grvSearch_RowCommand">
                                                        <Columns>
                                                            <asp:TemplateField HeaderText="Stt">
                                                                <HeaderTemplate>
                                                                    STT
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <%# Container.DataItemIndex + 1 %>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="50px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Số chứng từ">
                                                                <HeaderTemplate>
                                                                    Số chứng từ
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                   
                                                                    <asp:Label ID="lblSoChungTu" runat="server" Text='<%# Eval("docno")%>'></asp:Label>
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                            </asp:TemplateField>
                                                            <asp:TemplateField HeaderText="Ngày chứng từ">
                                                                <HeaderTemplate>
                                                                    Ngày chứng từ
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                 <asp:Label ID="lblNgayChungTu" runat="server" Text='<%# Eval("docdate")%>'></asp:Label>
                                                                  
                                                                </ItemTemplate>
                                                                <HeaderStyle HorizontalAlign="Left" Width="150px" />
                                                                <ItemStyle Height="40px" HorizontalAlign="Left" Width="150px" />
                                                            </asp:TemplateField>
                                                            
                                                             <asp:TemplateField>
                                                                 <ItemTemplate>
                                                                    <asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" 
                                                                    CommandName="chon" Height="25px" Width="25px" ImageUrl="~/Images/check.png" />
                                                                </ItemTemplate>
                                                                <ControlStyle BackColor="White" BorderColor="White" />
                                                                <FooterStyle BackColor="White" BorderColor="White" />
                                                                <HeaderStyle BackColor="White" BorderColor="White" />
                                                                <ItemStyle BackColor="White" BorderColor="White" />
                                                            </asp:TemplateField>
                                                        </Columns>
                                                    </asp:GridView>
                                        
                                        
                                        </td>
                                    </tr>


                         </table>
                    </div>

                </div>
                <!-- End Content search -->
                </ContentTemplate>
            </cc1:TabPanel>
            </cc1:TabContainer>
            <dxpc:ASPxPopupControl ID="MessageBox" PopupHorizontalAlign="WindowCenter"  PopupVerticalAlign="WindowCenter" Font-Bold="true" HeaderText="DRM-S" runat="server" Height="91px" 
        Width="601px">
        <ContentCollection>
<dxpc:PopupControlContentControl ID="PopupControlContentControl1" runat="server" SupportsDisabledAttribute="True"></dxpc:PopupControlContentControl>
</ContentCollection>
    </dxpc:ASPxPopupControl>
    </ContentTemplate>
</asp:UpdatePanel>

